// Copyright (C) 2008 Taylor L. Riche <riche@cs.utexas.edu>
//  
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software 
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//

#ifndef COMMCHANNEL_H_
#define COMMCHANNEL_H_

#include "Operator.h"
#include "RCon.h"
#include <map>

namespace lagniappe
{
class System;
class Operator;
class RCon;

class CommChannel
{
protected:
	unsigned long count;
	unsigned long totalCount;
	std::map<Operator *, unsigned long> opCountMap;
public:
	CommChannel();
	virtual ~CommChannel();
	CommChannel(unsigned long c, unsigned long tc) : count(c), totalCount(tc) {}
	virtual void put(RCon * rcon) = 0;
	virtual RCon * get() = 0;
	virtual bool empty() = 0;
	unsigned long incHeap(const RCon * rcon);
	unsigned long decHeap(const RCon * rcon);
	Operator * getLoadedOperator();
	unsigned long getTotalCount() {return totalCount;}
	unsigned long getCount() {return count;}
};

}

#endif /*COMMCHANNEL_H_*/
